package com.birdboot.core;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class BirdBootApplication {
    private ServerSocket serverSocket;
    BirdBootApplication(){
        try {
            serverSocket = new ServerSocket(8008);

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void start(){
        try {
            while (true) {
                Socket clientSocket = serverSocket.accept();
                System.out.println("客户端已连接：" + clientSocket.getInetAddress().toString());

                ClientHandler handler = new ClientHandler(clientSocket);
                Thread t = new Thread(handler);
                t.start();
            }

        }catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void main(String[] args) {
        BirdBootApplication app = new BirdBootApplication();
        app.start();
    }
}
